package cn.ges.movie.config.autowired

import com.ges.common.config.autowired.AutowiredUserId
import cn.ges.movie.util.UserIdHelper
import org.springframework.context.annotation.Configuration
import org.springframework.core.MethodParameter
import org.springframework.web.bind.support.WebDataBinderFactory
import org.springframework.web.context.request.NativeWebRequest
import org.springframework.web.method.support.ModelAndViewContainer

/**
 *
 * @author gespent@163.com
 * @date 2021/3/9 13:50
 */
@Configuration
open class AutowiredUserIdImpl : AutowiredUserId() {

    override fun resolveArgument(p0: MethodParameter, p1: ModelAndViewContainer?,
                                 p2: NativeWebRequest, p3: WebDataBinderFactory?): Any? {
        return UserIdHelper.getLongCurrentUserId()
    }

}